<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessageReadTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('message_read', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->integer('msg_id')->comment('消息id');
            $table->tinyInteger('is_read')->default(0)->comment('阅读状态0未阅读1已阅');
            $table->dateTime('read_time')->comment('阅读时间');
            $table->tinyInteger('flag')->default(1)->comment('删除状态1未删0已删');
            $table->index('is_read');
            $table->index('flag');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('message_read');
    }
}
